package util;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnManager {

	//数据库5大参数
	
	private static final String IP = "127.0.0.1";
	private static final String PORT = "3306";
	private static final String DATABASE_NAME = "student";
	private static final String USER_NAME = "root";
	private static final String PASSWORD = "123456";
	private static final String DRIVER = "org.gjt.mm.mysql.Driver";
	
	/* 备份
	//百度云
	private static final String IP = "sqld.duapp.com";
	private static final String PORT = "4050";
	private static final String DATABASE_NAME = "FcwsiqtJxwaZJcMYjqGt";
	private static final String USER_NAME = "4680618ecf7841c58f244e4d7c90e19a";
	private static final String PASSWORD = "6a6c04b0ab9645b687e8be601291605a";
	private static final String DRIVER = "org.gjt.mm.mysql.Driver";
	*/
	public static Connection getConnection() throws Exception {
		String url = "jdbc:mysql://"+IP+":"+PORT+"/"+DATABASE_NAME+"?user="+USER_NAME+"&password="+PASSWORD+"";
		Class.forName(DRIVER);
		Connection conn = DriverManager.getConnection(url);
		//System.out.println("ConnManager已经创建了连接："+conn);
		return conn;
	}

}
